from rest_framework import serializers

from apps.goods.models import GoodsChannel, GoodsChannelGroup, GoodsCategory

class GoodsChannelGroupSerializers(serializers.ModelSerializer):

    class Meta:
        model =  GoodsChannelGroup
        fields = ["id", "name"]


class GoodsCategorySerializers(serializers.ModelSerializer):
    class Meta:
        model = GoodsCategory
        fields = "__all__"

class GoodsChannelSerializers(serializers.ModelSerializer):
    group = GoodsChannelGroupSerializers()
    group_id = serializers.IntegerField()
    category = GoodsCategorySerializers()
    category_id = serializers.IntegerField()

    class Meta:
        model = GoodsChannel
        fields = "__all__"

